import { Directive, DirectiveBinding } from 'vue';

/**
 * 操作权限处理
 * el-select-dropdown长度为274 1px误差
 */
export const selectLoad: Directive = {
  mounted(el: HTMLElement, binding: DirectiveBinding) {
    let SELECT_DOM:any = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap');
    SELECT_DOM?.addEventListener('scroll', function () {
      let condition = SELECT_DOM.scrollHeight - SELECT_DOM.scrollTop <= 275;
      if (condition) {
        binding.value();
      }
    });
  }
};
